﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Box2D.XNA;
using Microsoft.Xna.Framework;
using ElementumForever.Interfaces;

namespace ElementumForever
{
   public class PhysicalWorld : World, IUpdateHandler
    {
        public int VelocityIterations { get; set; }
        public int PositionIterations { get; set; }

        public PhysicalConnectorManager PhysicalConnectorManager { get; private set; }

        public PhysicalWorld(Vector2 gravity, bool doSleep) : base(gravity, doSleep)
        {
            VelocityIterations = 10;
            PositionIterations = 10;
            PhysicalConnectorManager=new PhysicalConnectorManager();
        }

        public void OnUpdate(GameTime gameTime)
        {
            float dt = gameTime.ElapsedGameTime.Milliseconds;
            this.Step(1f/60f,VelocityIterations,PositionIterations);
            this.PhysicalConnectorManager.OnUpdate(gameTime);
        }


    }
}
